<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>颜色选择器</title>
</head>

<body>
    <select id="colorSelect">
        <option value="red">红</option>
        <option value="yellow">黄</option>
        <option value="blue">蓝</option>
    </select>
    <button onclick="changeTextColor()">确定</button>
    <p id="colorText">这是一段可变色的文字。</p>

    <script>
        function changeTextColor() {
            const selectElement = document.getElementById('colorSelect');
            const selectedColor = selectElement.value;
            const textElement = document.getElementById('colorText');
            textElement.style.color = selectedColor;
        }
    </script>
</body>

</html>
    